Skip to content

feat: multi-provider cli setup wizard and self-hosted iroh relay - #1070

Merged
ital0 merged 12 commits into
mainfrom
italomenezes/cli-multi-provider-wizard-iroh-relay
Jul 15, 2026
Merged

feat: multi-provider cli setup wizard and self-hosted iroh relay#1070
ital0 merged 12 commits into
mainfrom
italomenezes/cli-multi-provider-wizard-iroh-relay

Conversation

@ital0

@ital0 ital0 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Removes the CLI's hard Anthropic dependency and stands up the self-hosted iroh relay path. Originally stacked on #1032; now rebased onto main after that PR's squash-merge.

What

Multi-provider model resolution (cli/src/agent/)

  • --provider now accepts 14 builtin vendors resolved against the Pi catalog (anthropic, openai, google, xai, deepseek, zai, mistral, groq, openrouter, moonshotai, minimax, cerebras, together, fireworks) plus the existing openai-compat escape hatch.
  • Per-provider default models; explicit --api-key is threaded per-call and wins over env; each builtin provider keeps Pi's native env resolution (OPENAI_API_KEY, GEMINI_API_KEY, …).
  • Missing-credential errors moved into model resolution and name the exact env var + flag.

First-run setup wizard (cli/src/config/)

  • Plain thunderbolt with no credentials in a TTY now launches a 3-step wizard (17-choice vendor menu incl. Ollama/LM Studio presets and custom OpenAI-compatible endpoints → hidden API-key input → model pick) instead of erroring.
  • Persists to $THUNDERBOLT_HOME/config.json (mode 0600). Precedence: flag > env > config > default. Saved key/baseUrl are provider-scoped — a saved Anthropic key is never forwarded when --provider overrides to another vendor.
  • New thunderbolt config subcommand re-runs the wizard. Non-TTY keeps a crisp guidance error.

Self-hosted iroh relay — groundwork + docs only (deploy/iroh-relay/, docs/architecture/)

  • Local dev compose: docker compose up -d runs n0computer/iroh-relay:v1.0.2 --dev on :3340; both sides already accept overrides (THUNDERBOLT_IROH_RELAY_URL runtime CLI / VITE_IROH_RELAY_URL build-time app).
  • VPS-shaped template (config.example.toml): LetsEncrypt, QUIC address discovery (UDP 4433), shared-token access control, rate limits.
  • Public self-hosting guide covers what a relay does/doesn't (E2E crypto stays), what still queries n0 (DNS discovery for bare-NodeId dials; tickets don't need it), and the production hosting pattern.
  • Not in this PR — lands in the follow-up relay deploy work (THU-692): the production deploy/docker/iroh-relay.Dockerfile, deploy/config/iroh-relay.toml, and the images-publish.yml GHCR step. The architecture doc's "Production deployment" section documents that Render/GHCR pattern ahead of the artifacts by design; committing the three closes the reference.

Rebase notes (post-#1032 squash)

  • Home-dir resolution unified: iroh/paths.ts's thunderboltHomeDir() (from the ACP-sessions fix) and this branch's baseDir() were the same concept — now a single injectable thunderboltHomeDir() in cli/src/paths.ts, consumed by iroh state, ACP sessions, and the new config store.
  • Coexists with the workspace-jailed acp serve (workspaceRoot harness branch, bash dropped) — the jail path is preserved untouched; multi-provider resolution applies to both jailed and unjailed harnesses.
  • VERSION from package.json and the refreshed README (curl installer from feat(cli): add a curl-to-shell remote installer #1080, thunderbolt-cli-<target> binaries from build(cli): name release binaries thunderbolt-cli-<target> #1081) kept, with the multi-provider/wizard/config docs merged on top.

Validation

  • cli: tsc clean, 289 tests × 5 runs = 1445 pass / 0 fail post-rebase; root make check green (lint, prettier, license headers).
  • E2E (real PTY + browser, pre-rebase build): first-run wizard driven end-to-end in a PTY (key not echoed, config 0600, no restart into session); config reuse skips wizard; oneshot + TUI inference against live Anthropic; browser → self-hosted relay → CLI iroh bridge → two chat conversations answered (ticket base32-decodes to http://localhost:3340/, zero n0 relay involvement).

Follow-ups (not in this PR — tracked in Linear, project Zeus CLI)

  • THU-692 — deploy the relay to Render (iroh.thunderbolt.io), incl. committing the production artifacts named above.
  • THU-693 — bake the self-hosted relay as the default relay URL in CLI/app builds (override preserved).
  • THU-694 — web↔CLI bridge resilience: survive relay restarts without a page reload.
  • THU-698 — explore multi-relay failover (augmented relay map) for HA.
  • THU-699 — relay access hardening (shared_token via Authorization Bearer).
  • Replace n0 DNS discovery with a self-hosted discovery service for zero n0 dependency on bare-NodeId dials.

@github-actions

Copy link
Copy Markdown

Semgrep Security Scan

No security issues found.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

PR Metrics

Metric Value
Lines changed (prod code) +1279 / -201
JS bundle size (gzipped) 🟢 637.5 KB → 638.8 KB (+1.3 KB, +0.2%)
Test coverage 🟢 77.81% → 78.08% (+0.3%)
Performance (preview) Preview not ready — Render deploy may have timed out
Accessibility
Best Practices
SEO

Updated Wed, 15 Jul 2026 19:36:57 GMT · run #2311

@ital0 ital0 changed the title CLI: multi-provider setup wizard + self-hosted iroh relay feat: multi-provider cli setup wizard and self-hosted iroh relay Jul 10, 2026
Base automatically changed from italomenezes/thunderbolt-cli-mvp to main July 13, 2026 16:24
@ital0 ital0 self-assigned this Jul 13, 2026
@ital0
ital0 force-pushed the italomenezes/cli-multi-provider-wizard-iroh-relay branch from 1fb16db to 05e6c6c Compare July 13, 2026 20:48
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

Preview environment destroyed 🧹

Stack preview-pr-1070 and its Cloudflare subdomain have been cleaned up.

@ital0
ital0 marked this pull request as ready for review July 13, 2026 21:07

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔭 thunder-deep-review (advisory)

Complements the other bots — surfaces only what they did not flag. Never approves, never requests changes, never gates merge.
head: 05e6c6c83314 · mode: deep · deferred 0 item(s) already reported by other bots (best-effort dedup)

Comment thread cli/src/cli.ts Outdated
Comment thread cli/src/cli.test.ts

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔭 thunder-deep-review (advisory)

Reviewed the diff — no issues to report. ✅ Never approves, never requests changes, never gates merge.
head: 0c2a82150ba8 · mode: deep · deferred 0 item(s) already reported by other bots (best-effort dedup)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔭 thunder-deep-review (advisory)

Complements the other bots — surfaces only what they did not flag. Never approves, never requests changes, never gates merge.
head: f8aa49b9d2cd · mode: deep · deferred 0 item(s) already reported by other bots (best-effort dedup)

Comment thread cli/src/config/model-listing.ts Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔭 thunder-deep-review (advisory)

Complements the other bots — surfaces only what they did not flag. Never approves, never requests changes, never gates merge.
head: 445e48407905 · mode: deep · deferred 0 item(s) already reported by other bots (best-effort dedup)

Comment thread cli/src/cli.ts Outdated
Comment thread cli/src/config/model-listing.test.ts Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔭 thunder-deep-review (advisory)

Complements the other bots — surfaces only what they did not flag. Never approves, never requests changes, never gates merge.
head: d993285ff271 · mode: deep · deferred 0 item(s) already reported by other bots (best-effort dedup)

Comment thread docs/architecture/iroh-relay-self-hosting.md Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔭 thunder-deep-review (advisory)

Reviewed the diff — no issues to report. ✅ Never approves, never requests changes, never gates merge.
head: 80ac90b58afa · mode: deep · deferred 0 item(s) already reported by other bots (best-effort dedup)

@ital0
ital0 merged commit c2e88b3 into main Jul 15, 2026
31 checks passed
@ital0
ital0 deleted the italomenezes/cli-multi-provider-wizard-iroh-relay branch July 15, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant